{template 'admin','header'}
<form name="upload" method="post" action="attachment.php?action={$action}" enctype="multipart/form-data">
    <input type="hidden" name="fieldid" value="{$fieldid}">
    <input type="hidden" name="site_id" value="{$site_id}">
    <table cellpadding="2" cellspacing="1" class="table_form">
        <caption>{if $action=='upload_thumb'}图片{else}文件{/if}上传</caption>
        <tr>
            <td>
                <input name="thumb" type="file" size="15">
                <input type="submit" name="dosubmit" value=" 上传 ">
            </td>
        </tr>
        {if $action=='upload_thumb'}
        <tr>
            <td>
                允许上传类型：{ALLOW_THUMB_EXT}<br />
                允许上传大小：{$size}<br />
                缩略图大小(BMP图片不支持)：宽 <input type="text" name="maxwidth" value="{$maxwidth}" size="3"> px，高 <input type="text" name="maxheight" value="{$maxheight}" size="3"> px
            </td>
        </tr>
        {/if}
        <tr>
            <td>
                {if $action=='upload_thumb'}
                <img id="previewpic" onload="setpicWH(this,300,300)" src="{$thumb}">
                {/if}
                {if isset($dosubmit)}
                <script>
                    var fieldid = '{$fieldid}';
                    $(window.opener.document).find('#'+fieldid).val('{$thumb}');
                </script>
                {/if}
            </td>
        </tr>
    </table>
</form>
{if isset($dosubmit)}
{if $action=='upload_file'}
<script>
    window.close();
</script>
{/if}{/if}
{template 'admin','footer'}